package com.hjqjl.module_home.ui.list.recyclerview;

import android.content.Context;
import android.content.Intent;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.hjqjl.module_home.R;
import com.hjqjl.module_home.databinding.HomeActivityMultipleItemListBinding;
import com.hjqjl.module_home.model.MultipleItemModel;
import com.hjqjl.whapplib.base.BaseActivity;

import java.util.ArrayList;
import java.util.List;

public class MultipleItemListActivity extends BaseActivity<HomeActivityMultipleItemListBinding> {
    public static void start(Context context) {
        Intent starter = new Intent(context, MultipleItemListActivity.class);
        context.startActivity(starter);
    }

    private List<MultipleItemModel> mMultipleItemModelList = new ArrayList<>();

    @Override
    public void initData() {
        initMultipleItemModels();
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        pVBinding.homeRvMultipleItemList.setLayoutManager(layoutManager);
        MultipleItemAdapter adapter = new MultipleItemAdapter(mMultipleItemModelList);
        pVBinding.homeRvMultipleItemList.setAdapter(adapter);
    }

    private void initMultipleItemModels() {
        mMultipleItemModelList.add(new MultipleItemModel(0, "我是个标题", 0));
        for (int i = 0; i < 2; i++) {
            MultipleItemModel apple = new MultipleItemModel(1, "Apple", R.drawable.ic_image_default);
            mMultipleItemModelList.add(apple);
            MultipleItemModel banana = new MultipleItemModel(1, "Banana", R.drawable.ic_image_default);
            mMultipleItemModelList.add(banana);
            MultipleItemModel orange = new MultipleItemModel(1, "Orange", R.drawable.ic_image_default);
            mMultipleItemModelList.add(orange);
            MultipleItemModel watermelon = new MultipleItemModel(1, "Watermelon", R.drawable.ic_image_default);
            mMultipleItemModelList.add(watermelon);
            MultipleItemModel pear = new MultipleItemModel(1, "Pear", R.drawable.ic_image_default);
            mMultipleItemModelList.add(pear);
            MultipleItemModel grape = new MultipleItemModel(1, "Grape", R.drawable.ic_image_default);
            mMultipleItemModelList.add(grape);
            MultipleItemModel pineapple = new MultipleItemModel(1, "Pineapple", R.drawable.ic_image_default);
            mMultipleItemModelList.add(pineapple);
            MultipleItemModel strawberry = new MultipleItemModel(1, "Strawberry", R.drawable.ic_image_default);
            mMultipleItemModelList.add(strawberry);
            MultipleItemModel cherry = new MultipleItemModel(1, "Cherry", R.drawable.ic_image_default);
            mMultipleItemModelList.add(cherry);
            MultipleItemModel mango = new MultipleItemModel(1, "Mango", R.drawable.ic_image_default);
            mMultipleItemModelList.add(mango);
        }
    }
}
